package com.demo4;

public class Master {
    public void cure(Pet pet){//Dog
        if(pet.getHealth()<50);
        pet.toHospital();
        System.out.println("多喝热水。。");
    }

    public static void main(String[] args) {
        Master master = new Master();

        Pet p = new Dog();
        p.setName("冷锋");
        p.setHealth(40);
        p.setLove(99);
        master.cure(p);
        p = new Penguin();
        p.setName("马化腾");
        p.setHealth(20);
        p.setLove(100);
        master.cure(p);
    }

}
